package com.fled.itsmbigscreen.controller;

import com.fled.itsmbigscreen.dto.FindHighBugClient.FindHighBugClientDto;
import com.fled.itsmbigscreen.dto.GroupAddDto;
import com.fled.itsmbigscreen.dto.GroupDelDto;
import com.fled.itsmbigscreen.dto.GroupEditNameDto;
import com.fled.itsmbigscreen.dto.clientInfoDto.ClientListDto;
import com.fled.itsmbigscreen.dto.clientListDto.ClientListData;
import com.fled.itsmbigscreen.dto.groupDto.HuorongBaseList;
import com.fled.itsmbigscreen.pojo.DeviceAlarm;
import com.fled.itsmbigscreen.response.BaseResult;
import com.fled.itsmbigscreen.response.RetResponse;
import com.fled.itsmbigscreen.service.HuorongService;
import com.fled.itsmbigscreen.service.RoomService;
import com.fled.itsmbigscreen.vo.GetCabinetInfoByCidVo;
import com.fled.itsmbigscreen.vo.GetCabinetListVo;
import com.fled.itsmbigscreen.vo.GroupAddVo;
import com.fled.itsmbigscreen.vo.RoomListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(description = "服务器接口")
@CrossOrigin
@RequestMapping("/server")
@RestController
public class ServerController {


    @Autowired
    private RoomService roomService;



    @ApiOperation("获取机房列表")
    @GetMapping("/RoomList")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RoomListVo.class)
    })
    public BaseResult RoomList() {
        try {
            List<RoomListVo> list = roomService.roomList();
            return RetResponse.makeOKRsp(list);
        } catch (Exception e) {
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }

    @ApiOperation("获取机房简易列表")
    @GetMapping("/SimpleRoomList")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RoomListVo.class)
    })
    public BaseResult SimpleRoomList() {
        try {
            List<RoomListVo> list = roomService.SimpleRoomList();
            return RetResponse.makeOKRsp(list);
        } catch (Exception e) {
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }

    @ApiOperation("获取机房描述信息")
    @GetMapping("/roomInfo")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RoomListVo.class)
    })
    public BaseResult roomInfo(Integer roomId) {
        try {
            RoomListVo vo = roomService.roomInfo(roomId);
            return RetResponse.makeOKRsp(vo);
        } catch (Exception e) {
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }


    @ApiOperation("获取告警")
    @GetMapping("/getAlertList")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = DeviceAlarm.class)
    })
    public BaseResult getAlertList(Integer roomId) {
        try {
            List<DeviceAlarm> list = roomService.getAlertList(roomId);
            return RetResponse.makeOKRsp(list);
        } catch (Exception e) {
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }

    @ApiOperation("根据房间获取机柜信息")
    @GetMapping("/getCabinetList")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = GetCabinetListVo.class)
    })
    public BaseResult getCabinetList(Integer roomId) {
        try {
            List<GetCabinetListVo> list = roomService.getCabinetList(roomId);
            return RetResponse.makeOKRsp(list);
        } catch (Exception e) {
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }



}
